feat(events): make card, ACL and board events webhook-compatible#7910
Conversation
Implement OCP\EventDispatcher\IWebhookCompatibleEvent on the event base classes used by Deck so the webhook_listeners app (NC >= 30) can deliver them. Card events serialize the full Card payload, ACL events serialize the Acl entity (with the token already stripped by Acl:: jsonSerialize), and BoardUpdatedEvent exposes the board id it carries. Refs nextcloud#1722, nextcloud#7299, nextcloud#3341 Signed-off-by: Chris Coutinho <chris@coutinho.io>
2427d32 to
d85e1c8
Compare
grnd-alt
left a comment
There was a problem hiding this comment.
thanks for your contribution, great!
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
Implements
OCP\EventDispatcher\IWebhookCompatibleEventon Deck's event base classes so thewebhook_listenersapp (added in NC 30) can serialize and deliver them. Today Deck dispatches plainOCP\EventDispatcher\Eventinstances, so the listener has nothing to serialize and Deck cannot drive any webhook automation.This is the path the maintainer suggested in #3341 (use
flow_webhooksrather than building a webhook system inside Deck). With this change in place, an admin can register listeners forOCA\Deck\Event\CardCreatedEvent,CardUpdatedEvent,CardDeletedEvent,BoardUpdatedEvent, and the ACL events directly through the existing webhook UI.Changes
lib/Event/ACardEvent.phpimplements IWebhookCompatibleEvent—getWebhookSerializable()returns['card' => $card->jsonSerialize()](coversCardCreatedEvent,CardUpdatedEvent,CardDeletedEvent)lib/Event/AAclEvent.phpimplements IWebhookCompatibleEvent—getWebhookSerializable()returns['acl' => $acl->jsonSerialize()]. The existingAcl::jsonSerialize()already stripstoken, so it is not exposed via webhookslib/Event/BoardUpdatedEvent.phpimplements IWebhookCompatibleEvent— returns['boardId' => $boardId](the event only carries the id today; receivers can fetch detail via API if needed)tests/unit/Event/WebhookCompatibleEventsTest.phpCardCreatedEvent,AclCreatedEvent, andBoardUpdatedEventThe shape (
{"<entity>": …}) follows the convention used by core OCP events such asOCP\Files\Events\Node\AbstractNodeEventandOCP\SystemTag\TagAssignedEvent.Compatibility
appinfo/info.xmlrequiresnextcloud min-version="34".IWebhookCompatibleEventwas introduced in NC 30, so no version gate is needed.Refs
Test plan
composer test:unit)OCA\Deck\Event\CardCreatedEventand confirm the receiver gets{"event": {"card": {…}}, …}CardUpdatedEvent,CardDeletedEvent,BoardUpdatedEvent,AclCreatedEventtokenfield is absent from the ACL payloadThis PR was generated with the help of AI, and reviewed by a Human